﻿using System.Collections.Generic;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.AI
{
    public class TriggerLightJunction : MonoBehaviour
    {

        public List<TrafficCarTrigger> carTriggers;

        public List<TrafficNpcTrigger> npcTriggers;


        public void SwitchGreenState(bool state)
        {
            if (carTriggers!=null)
            {
                foreach (var carTrigger in carTriggers)
                {
                    carTrigger.greenState = state;
                    
                    // 车可以走了，通知等待车辆加速
                    
                }
            }

            if (npcTriggers != null)
            {
                                
                foreach (var npcTrigger in npcTriggers)
                {
                    npcTrigger.greenState = state;
                    
                    // 行人可以走了，清空等待点占用状态
                    
                }
            }
        }

        public void SwitchYellowState(bool state)
        {
            if (carTriggers!=null)
            {
                foreach (var carTrigger in carTriggers)
                {
                    carTrigger.yellowState = state;
                }
            }
            
            if (npcTriggers!=null)
            {
                foreach (var npcTrigger in npcTriggers)
                {
                    npcTrigger.yellowState = state;
                }
            }
        }

    }
}